inspector: Show object address
authorMatthias Clasen <mclasen@redhat.com>
Fri, 9 Jan 2015 05:07:01 +0000 (00:07 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 9 Jan 2015 05:07:01 +0000 (00:07 -0500)
This is useful information when running the application
in a debugger.
https://bugzilla.gnome.org/show_bug.cgi?id=742518

gtk/inspector/misc-info.c
gtk/inspector/misc-info.ui
gtk/inspector/misc-info.ui.h

index 450269513ec01cef513ea4bec85e990d334eb64e..d390c16abd253784347b126f63e33e35d0809eb4 100644 (file)
@@ -36,6 +36,7 @@ struct _GtkInspectorMiscInfoPrivate {
 
   GObject *object;
 
+  GtkWidget *address;
   GtkWidget *refcount_row;
   GtkWidget *refcount;
   GtkWidget *state_row;
@@ -258,7 +259,7 @@ show_focus_widget (GtkWidget *button, GtkInspectorMiscInfo *sl)
 
   widget = gtk_window_get_focus (GTK_WINDOW (sl->priv->object));
   if (widget)
-    show_object (sl, G_OBJECT (widget), "properties"); 
+    show_object (sl, G_OBJECT (widget), "properties");
 }
 
 static void
@@ -277,13 +278,17 @@ update_info (gpointer data)
   GtkInspectorMiscInfo *sl = data;
   gchar *tmp;
 
+  tmp = g_strdup_printf ("%p", sl->priv->object);
+  gtk_label_set_text (GTK_LABEL (sl->priv->address), tmp);
+  g_free (tmp);
+
   if (G_IS_OBJECT (sl->priv->object))
     {
       tmp = g_strdup_printf ("%d", sl->priv->object->ref_count);
       gtk_label_set_text (GTK_LABEL (sl->priv->refcount), tmp);
       g_free (tmp);
     }
-  
+
   if (GTK_IS_WIDGET (sl->priv->object))
     {
       AtkObject *accessible;
@@ -549,6 +554,7 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
                            GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/misc-info.ui");
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, address);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, refcount_row);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, refcount);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, state_row);
index c8c75bc4a7a81b690919fef5e9a199af19d1d201..c51814d5a551e02544d877d3fb617868a938c610 100644 (file)
               <object class="GtkListBox">
                 <property name="visible">True</property>
                 <property name="selection-mode">none</property>
+                <child>
+                  <object class="GtkListBoxRow" id="address_row">
+                    <property name="visible">True</property>
+                    <property name="activatable">False</property>
+                    <child>
+                      <object class="GtkBox">
+                        <property name="visible">True</property>
+                        <property name="orientation">horizontal</property>
+                        <property name="margin">10</property>
+                        <property name="spacing">40</property>
+                        <child>
+                          <object class="GtkLabel" id="address_label">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Address</property>
+                            <property name="halign">start</property>
+                            <property name="valign">baseline</property>
+                            <property name="xalign">0.0</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="address">
+                            <property name="visible">True</property>
+                            <property name="selectable">True</property>
+                            <property name="halign">end</property>
+                            <property name="valign">baseline</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
                 <child>
                   <object class="GtkListBoxRow" id="refcount_row">
                     <property name="visible">True</property>
                         <child>
                           <object class="GtkLabel" id="default_widget">
                             <property name="visible">True</property>
+                            <property name="selectable">True</property>
                             <property name="halign">end</property>
                             <property name="valign">baseline</property>
                           </object>
                         <child>
                           <object class="GtkLabel" id="focus_widget">
                             <property name="visible">True</property>
+                            <property name="selectable">True</property>
                             <property name="halign">end</property>
                             <property name="valign">baseline</property>
                             <property name="ellipsize">end</property>
   <object class="GtkSizeGroup">
     <property name="mode">horizontal</property>
     <widgets>
+      <widget name="address_label"/>
+      <widget name="refcount_label"/>
       <widget name="state_label"/>
       <widget namel="buildable_id_label"/>
       <widget name="default_widget_label"/>
index a09a285e51989c5fd0f9ba89752c35fe1dec4158..d843c0902dd6fee84c07b2824fded941e6bdc843 100644 (file)
@@ -1,3 +1,4 @@
+N_("Address");
 N_("Reference count");
 N_("State");
 N_("Buildable ID");